tools/libxl: use qdisk if blktap2 is not available
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 23 Nov 2010 19:23:22 +0000 (19:23 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 23 Nov 2010 19:23:22 +0000 (19:23 +0000)
Whenever blktap2 is not available use qdisk as block backend instead.

[ This feature will only work with the relevant changesets from
  qemu-xen-unstable, recently applied.  -iwj ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_device.c
tools/libxl/libxl_internal.h

index 5bf4e39525cfc01d6e367cf862a04a1defae2fcf..2b93565ee5011e14cc5647612137205e979da568 100644 (file)
@@ -1856,7 +1856,10 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
             flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s",
                           libxl__device_disk_string_of_phystype(disk->phystype), disk->physpath));
 
-            device.backend_kind = DEVICE_TAP;
+            if (libxl__blktap_enabled(&gc))
+                device.backend_kind = DEVICE_TAP;
+            else
+                device.backend_kind = DEVICE_QDISK;
             break;
 
         default:
index 2a4f569e3192a5b9109e7f6527ae3aef561903a5..ad7f8bc1135ab98a8d8fb5627c44b5c7d671b08e 100644 (file)
@@ -33,6 +33,7 @@ static const char *string_of_kinds[] = {
     [DEVICE_VIF2] = "vif2",
     [DEVICE_VBD] = "vbd",
     [DEVICE_TAP] = "tap",
+    [DEVICE_QDISK] = "qdisk",
     [DEVICE_PCI] = "pci",
     [DEVICE_VFB] = "vfb",
     [DEVICE_VKBD] = "vkbd",
index e3fc22dd9f0b2c73448938b48fa16ba161b043f9..0d50851edf3d67f827db8b0f3ff29c7ecb6379fb 100644 (file)
@@ -82,6 +82,7 @@ typedef enum {
     DEVICE_VIF2,
     DEVICE_VBD,
     DEVICE_TAP,
+    DEVICE_QDISK,
     DEVICE_PCI,
     DEVICE_VFB,
     DEVICE_VKBD,